﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Collections;

/// <summary>
/// 指标资料文件类
/// </summary>
public class ZBJLFiles
{
    private string _title;
   
    private string tableName ="ZBZL"+DateTime.Now.Year;
    private DBOperation db = new DBOperation();
    private bool seccess = false;

	public ZBJLFiles()
	{
	}
    public ZBJLFiles(string title)
    {
        _title = title;
     
    }
  
    /// <summary>
    /// 删除文件
    /// </summary>
    /// <param name="fileID">文件ID</param>
    /// <returns>Boolean</returns>
    public bool DelFile(int fileID)
    {
        string strDelFile = "delete from "+tableName+" where AUTOID="+fileID;
        seccess = db.ExcuteSql(strDelFile);
        return seccess;
    }
    /// <summary>
    /// 读取文件信息
    /// </summary>
    /// <returns>dataSet</returns>
    public DataSet ReadfileInfo()
    {
        string strReadFileInfo = "select * from " + tableName + " order by AUTOID desc";
        string tableFileName = "ZBZL";
        DataSet ds = db.GetDataSet(strReadFileInfo,tableFileName);
        return ds;
    }
    /// <summary>
    /// 查找是否存在同名文件
    /// </summary>
    /// <param name="fileName"></param>
    /// <returns></returns>
    public bool CheckName(string fileName)
    {
        string strCheckName = "select AUTOID from "+tableName+" where TITLE='"+fileName+"'" ;
        Object ob = db.ExcuteScalar(strCheckName);
        if (ob != null)
        {
            seccess = true;
        }
        return seccess;
    }
    public bool UpFiles(ArrayList sqlList)
    {
        seccess = db.ExcuteSqls(sqlList);
        return seccess;
    }
    public bool DelFiles(ArrayList delSqlList)
    {
        seccess = db.ExcuteSqls(delSqlList);
        return seccess;
    }
}
